﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Survivalist
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SurvivalistSettings.myPrefs.Load();

            chckDisableFacing.Checked = SurvivalistSettings.myPrefs.DisableAllFacement;
            chckDisableAllMovement.Checked = SurvivalistSettings.myPrefs.DisableAllMovement;
            chckMultiShot.Checked = SurvivalistSettings.myPrefs.useMultiShot;
            chckMarkForDeath.Checked = SurvivalistSettings.myPrefs.MarkedForDeath;
            chckIronHawk.Checked = SurvivalistSettings.myPrefs.IronHawk;
            chckTier4NotNormalMobs.Checked = SurvivalistSettings.myPrefs.UseNotTier4OnNormalMobs;
            chckTier5NotOnNormalMobs.Checked = SurvivalistSettings.myPrefs.UseNotTier5OnNormalMobs;
            chckTier6NotOnNormalMobs.Checked = SurvivalistSettings.myPrefs.UseNotTier6OnNormalMobs;
            chckAlwaysReadiness.Checked = SurvivalistSettings.myPrefs.AlwaysReadiness;
            chckAlwaysRapidFire.Checked = SurvivalistSettings.myPrefs.AlwaysRapidFire;
            


            numUDMendPet.Value = new decimal(SurvivalistSettings.myPrefs.Mendpet);
            numUDLifeSpirit.Value = new decimal(SurvivalistSettings.myPrefs.UseLifeSpirit);
            numUDHealthstone.Value = new decimal(SurvivalistSettings.myPrefs.UseHealthStone);
            numUDAOE.Value = new decimal(SurvivalistSettings.myPrefs.UseAOE);
            numUDElitesLikeBosses.Value = new decimal(SurvivalistSettings.myPrefs.HandleAsBoss);
            numUDLvlDiff.Value = new decimal(SurvivalistSettings.myPrefs.lvlDiff);

            if (SurvivalistSettings.myPrefs.CallMyPet == "Call Pet 1")
            {
                rbtnPet1.Select();
            }
            else if (SurvivalistSettings.myPrefs.CallMyPet == "Call Pet 2")
            {
                rbtnPet2.Select();
            }
            else if (SurvivalistSettings.myPrefs.CallMyPet == "Call Pet 3")
            {
                rbtnPet3.Select();
            }
            else if (SurvivalistSettings.myPrefs.CallMyPet == "Call Pet 4")
            {
                rbtnPet4.Select();
            }
            else if (SurvivalistSettings.myPrefs.CallMyPet == "Call Pet 5")
            {
                rbtnPet5.Select();
            }
            if (SurvivalistSettings.myPrefs.Misdirection == "pet")
            {
                rbtnMisdirectionOnPet.Select();
            }
            else if (SurvivalistSettings.myPrefs.Misdirection == "focus")
            {
                rbtnMisdirectionOnFocus.Select();
            }
            if (SurvivalistSettings.myPrefs.Tier4 == "Dire Beast")
            {
                rbtnDireBeast.Select();
            }
            else if (SurvivalistSettings.myPrefs.Tier4 == "Fervor")
            {
                rbtnFervor.Select();
            }
            if (SurvivalistSettings.myPrefs.Tier5 == "A Murder of Crows")
            {
                rbtnMurderCrows.Select();
            }
            else if (SurvivalistSettings.myPrefs.Tier5 == "Blink Strike")
            {
                rbtnBlinkStrike.Select();
            }
            else if (SurvivalistSettings.myPrefs.Tier5 == "Lynx Rush")
            {
                rbtnLynxRush.Select();
            }
            if (SurvivalistSettings.myPrefs.UseTrinket1 == "always")
            {
                rbtnTrinket1A.Select();
            }
            else if (SurvivalistSettings.myPrefs.UseTrinket1 == "boss")
            {
                rbtnTrinket1B.Select();
            }
            else if (SurvivalistSettings.myPrefs.UseTrinket1 == "never")
            {
                rbtnTrinket1N.Select();
            }
            if (SurvivalistSettings.myPrefs.UseTrinket2 == "always")
            {
                rbtnTrinket2A.Select();
            }
            else if (SurvivalistSettings.myPrefs.UseTrinket2 == "boss")
            {
                rbtnTrinket2B.Select();
            }
            else if (SurvivalistSettings.myPrefs.UseTrinket2 == "never")
            {
                rbtnTrinket2N.Select();
            }
        }
        #region SaveButtons
        private void btnSaveConfigSettings_Click(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Save();
            
        }

        private void btnSaveConfigPet_Click(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Save();
            
        }

        private void btnSaveConfigTalents_Click(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Save();
            
        }
        #endregion SaveButtons

        #region CallPetButtons
        private void rbtnPet1_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.CallMyPet = "Call Pet 1";
        }

        private void rbtnPet2_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.CallMyPet = "Call Pet 2";
        }

        private void rbtnPet3_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.CallMyPet = "Call Pet 3";
        }

        private void rbtnPet4_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.CallMyPet = "Call Pet 4";
        }

        private void rbtnPet5_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.CallMyPet = "Call Pet 5";
        }
        #endregion CallPetButtons

        private void rbtnMisdirectionOnPet_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Misdirection = "pet";
        }

        private void rbtnMisdirectionOnFocus_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Misdirection = "focus";
        }

        private void numUDMendPet_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Mendpet = (int)numUDMendPet.Value;
        }

        private void numUDHealthstone_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseHealthStone = (int)numUDHealthstone.Value;
        }

        private void numUDLifeSpirit_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseLifeSpirit = (int)numUDLifeSpirit.Value;
        }

        private void chckDisableAllMovement_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.DisableAllMovement = chckDisableAllMovement.Checked;
        }

        private void chckDisableFacing_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.DisableAllFacement = chckDisableFacing.Checked;
        }

        private void chckMultiShot_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.useMultiShot = chckMultiShot.Checked;
        }

        private void numUDAOE_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseAOE = (int)numUDAOE.Value;
        }

        private void chckMarkForDeath_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.MarkedForDeath = chckMarkForDeath.Checked;
        }

        private void chckIronHawk_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.IronHawk = chckIronHawk.Checked;
        }

        private void rbtnDireBeast_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier4 = "Dire Beast";
        }

        private void rbtnFervor_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier4 = "Fervor";
        }

        private void chckTier4NotNormalMobs_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseNotTier4OnNormalMobs = chckTier4NotNormalMobs.Checked;
        }

        private void rbtnBarrage_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier6 = "Barrage";
        }

        private void rbtnGlaiveToss_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier6 = "Glaive Toss";
        }

        private void rbtnPowershot_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier6 = "Powershot";
        }

        private void chckTier6NotOnNormalMobs_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseNotTier6OnNormalMobs = chckTier6NotOnNormalMobs.Checked;
        }

        private void chckTier5NotOnNormalMobs_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseNotTier5OnNormalMobs = chckTier5NotOnNormalMobs.Checked;
        }

        private void rbtnMurderCrows_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier5 = "A Murder of Crows";
        }

        private void rbtnBlinkStrike_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier5 = "Blink Strike";
        }

        private void rbtnLynxRush_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Tier5 = "Lynx Rush";
        }

        private void rbtnTrinket1A_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket1 = "always";
        }

        private void rbtnTrinket1B_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket1 = "boss";
        }

        private void rbtnTrinket1N_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket1 = "never";
        }

        private void rbtnTrinket2A_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket2 = "always";
        }

        private void rbtnTrinket2B_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket2 = "boss";
        }

        private void rbtnTrinket2N_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.UseTrinket2 = "never";
        }

        private void btnHealing_Click(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.Save();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (chckAlwaysRapidFire.Checked) { SurvivalistSettings.myPrefs.UseRapidFire = "boss"; }
            
            SurvivalistSettings.myPrefs.Save();
            Close();
        }

        private void numUDElitesLikeBosses_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.HandleAsBoss = (int)numUDElitesLikeBosses.Value;
        }

        private void numUDLvlDiff_ValueChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.lvlDiff = (int)numUDLvlDiff.Value;
        }

        private void chckAlwaysRapidFire_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.AlwaysRapidFire = chckAlwaysRapidFire.Checked;
        }

        private void chckAlwaysReadiness_CheckedChanged(object sender, EventArgs e)
        {
            SurvivalistSettings.myPrefs.AlwaysReadiness = chckAlwaysReadiness.Checked;

        }
        
    }
}
